package com.jeff.tianti.cms.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.jeff.tianti.common.entity.MysqlSequenceIdEntity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "answers")//问答管理用户回答部分
@JsonIgnoreProperties(value={"questionsAnswers","hibernateLazyInitializer","handler","fieldHandler"})
public class Answers extends MysqlSequenceIdEntity implements Serializable {
    //审核状态标识位—未审核
    public static final String AUDIT_FLAG_NOT = "0";

    //审核状态标识位—审核通不过
    public static final String AUDIT_FLAG_PASS = "1";

    //审核状态标识位—审核通过
    public static final String AUDIT_FLAG_FAIL = "2";
    private static final long serialVersionUID = 9031941601089869343L;

    private String questionsAnswersId;//问答管理表主键
    private QuestionsAnswers questionsAnswers;
    private String uid;//用户     官方回复 uid 为0
    private GateUser gateUser;
    private String text;//咨询内容
    private String reply;//回复
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date replyDate;//回答时间
    private String auditFlag;//审核字段 0->待审核 1->审核不通过 2审核通过
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createDate;
    @Column(name = "que_uid")
    private String queUid;//创建问题的用户
    public String getQueUid() {
        return queUid;
    }
    public void setQueUid(String queUid) {
        this.queUid = queUid;
    }

    @Column(name = "create_date")
    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    @Column(name = "questions_answers_id")
    public String getQuestionsAnswersId() {
        return questionsAnswersId;
    }

    public String getReply() {
        return reply;
    }

    public void setReply(String reply) {
        this.reply = reply;
    }

    public void setQuestionsAnswersId(String questionsAnswersId) {
        this.questionsAnswersId = questionsAnswersId;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "questions_answers_id",insertable = false,updatable = false)
    public QuestionsAnswers getQuestionsAnswers() {
        return questionsAnswers;
    }

    public void setQuestionsAnswers(QuestionsAnswers questionsAnswers) {
        this.questionsAnswers = questionsAnswers;
    }

    @Column(name = "uid")
    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    @ManyToOne
    @JoinColumn(name = "uid",updatable = false,insertable = false)
    public GateUser getGateUser() {
        return gateUser;
    }

    public void setGateUser(GateUser gateUser) {
        this.gateUser = gateUser;
    }

    @Column(name = "text")
    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    @Column(name = "reply_date")
    public Date getReplyDate() {
        return replyDate;
    }

    public void setReplyDate(Date replyDate) {
        this.replyDate = replyDate;
    }

    @Column(name = "audit_flag")
    public String getAuditFlag() {
        return auditFlag;
    }

    public void setAuditFlag(String auditFlag) {
        this.auditFlag = auditFlag;
    }
}
